#!/bin/sh

P="/etc/charon/hosts/"


HUTMP=/tmp/hostupdate.$$

hostupdate() {
	echo $2 | sed -e 's/,/\n/g' | sed -e "s/$/ $1/" | sort > $HUTMP
	[ -e $P/$1 ] && [ "$(cat $HUTMP)" = "$(cat $P/$1)" ] && rm $HUTMP && return
	UPDATED=true
	cp $HUTMP $P/$1
	rm $HUTMP
}

HOSTS=

hostget() {
	HOSTS=
	for i in $*; do
		TMP=
		[ -e $P/$i ] && TMP=`cut -d' ' -f1 $P/$i` && HOSTS="$HOSTS $TMP"
	done
}
